import { reactive } from 'vue';

export default function importComfig() {
  const base = reactive<any>({
    dataList: null,
  });

  const init = () => {};

  /**
   * @exports testDataList 测试用封装数据
   */
  const testDatLaist = () => {
    const steam = [
      {
        label: '测试输入框',
        type: 'input',
        tip: '请输入测试信息',
        value: null,
        key: null,
        index: 0,
        style: null,
        config: null,
      },
      {
        label: '测试输入框',
        type: 'select',
        tip: '请输入测试信息',
        value: null,
        key: null,
        index: 0,
        selectData: [],
        style: null,
        config: null,
      },
      {
        label: '测试输入框',
        type: 'datePicker',
        tip: '请输入测试信息',
        value: null,
        key: null,
        index: 0,
        style: null,
        config: null,
      },
    ];
    return steam;
  };

  const staeanc = {
    contentType: 'json',
    headers: { 'Content-Type': 'text/plain; charset=utf-8' },
    method: 'post',
    paramsResolve:
      '#set($parameter= $bodyMap.std_data.parameter){"key":"f5458f5c0f9022db743a7c0710145903","type": "sync","host": {"prod": "APP","ip": "192.168.1.211","lang": "$parameter.appBase.lang","acct": "$parameter.req.acct","timestamp": "$parameter.appBase.timestamp"},"service": {"prod": "T100","name": "$parameter.req.name","ip": "192.168.1.211","id": "topprd"},"datakey": {"EntId": "$parameter.appBase.ent","CompanyId": "$parameter.appBase.site"},"payload": {"std_data": {"parameter": {"ent": "$parameter.appBase.ent","site": "$parameter.appBase.site","doc_no": "$parameter.req.docNo","data": $parameter.req.docList,"postDate": "$parameter.req.postDate","updateErpDocDate":"$parameter.req.updateErpDocDate","erpRemark":"$parameter.req.erpRemark","host": {"acct": "$parameter.req.acct","timestamp": "$parameter.appBase.timestamp","appmodule": "$parameter.appBase.appmodule","name": "$parameter.req.name","EntId": "$parameter.appBase.ent","CompanyId": "$parameter.appBase.site","postDate": "$parameter.req.postDate","updateErpDocDate": "$parameter.req.updateErpDocDate","erpRemark":"$parameter.req.erpRemark zhilink","giftFlag":"0"}}}}}',
    responeTemplate:
      '#set ($doc_no = $map.payload.std_data.parameter.result[0].doc_no)   ##标准返回如采购收货#set ($execution= $map.payload.std_data.execution){"std_data":{"execution": $execution,"parameter": {"result": [{"docNo": "$!field$!doc_no$!field2"}]}}}',
    serviceCode: 'produceErpDocument',
    serviceName: '快速收货',
    serviceParams: {
      std_data: {
        parameter: {
          appBase: {
            ent: 'SF',
            site: '1',
            lang: 'zh_CN',
            appmodule: 'A010',
            timestamp: '86306401048210948:D2:24:78:28:2B48d22478282b7150A00118041111090912',
          },
          req: {
            name: 'als.a010.upload',
            acct: 'caihf',
            docNo: '3501-240127002',
            postDate: '2024-01-29',
            updateErpDocDate: '2024-01-29',
            erpRemark: '测试',
            docList: [
              {
                seq: '1',
                doc_no: '3501-240127002',
                warehouseNo: '110',
                itemNo: '520200001',
                qty: '1',
                applyQty: '1',
                postDate: '2024-01-29',
                updateErpDocDate: '2018-12-19',
                erpRemark: '测试',
              },
              {
                seq: '2',
                doc_no: '3501-240127002',
                warehouseNo: '110',
                itemNo: '520100009',
                qty: '1',
                applyQty: '1',
                postDate: '2024-01-29',
                updateErpDocDate: '2024-01-29',
                erpRemark: '测试',
              },
            ],
          },
        },
      },
    },
    url: '',
    urlId: 'E10',
  };
  console.log(JSON.stringify(JSON.stringify(staeanc)));
  const sasa = {
    serviceCode: 'produceErpDocument',
    serviceName: '快速收货',
    serviceParams:
      '{"std_data":{"parameter":{"appBase":{"ent":"SF","site":"1","lang":"zh_CN","appmodule":"A010","timestamp":"86306401048210948:D2:24:78:28:2B48d22478282b7150A00118041111090912"},"req":{"name":"als.a010.upload","acct":"caihf","docNo":"3501-240127002","postDate":"2024-01-29","updateErpDocDate":"2024-01-29","erpRemark":"测试","docList":[{"seq":"1","doc_no":"3501-240127002","warehouseNo":"110","itemNo":"520200001","qty":"1","applyQty":"1","postDate":"2024-01-29","updateErpDocDate":"2018-12-19","erpRemark":"测试"},{"seq":"2","doc_no":"3501-240127002","warehouseNo":"110","itemNo":"520100009","qty":"1","applyQty":"1","postDate":"2024-01-29","updateErpDocDate":"2024-01-29","erpRemark":"测试"}]}}}}',
  };
  console.log(JSON.stringify(sasa));
  return {
    base,
    init,
    testDatLaist,
  };
}
